<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
    if(session.getAttribute("currentUser")==null){
        response.sendRedirect("login.jsp");
    }
%>
<html lang="zh">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>个人日记本主页</title>
    <link href="${pageContext.request.contextPath}/static/css/personal.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/bootstrap/css/bootstrap.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
    <script src="${pageContext.request.contextPath}/static/bootstrap/js/jQuery.js"></script>
    <script src="${pageContext.request.contextPath}/static/bootstrap/js/bootstrap.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/jQuery.js"></script>
    <script>
        function checkForm() {
            var s_title = $("#s_title").val();
            if(s_title=="" || s_title==null){
                alert("请输入日志标题！");
                return false
            }
            return true;
        }
    </script>

    <style type="text/css">
        body {
            padding-top: 60px;
            padding-bottom: 40px;
        }
    </style>
</head>
<body>
<div class="row">
    <div class="navbar navbar-inverse navbar-fixed-top">
        <div class="navbar-inner">
            <div class="container">
                <a class="brand" href="${pageContext.request.contextPath}/main?all=true">个人空间管理系统</a>
                <div class="nav-collapse">
                    <ul class="nav">
                        <li class="active"><a href="${pageContext.request.contextPath}/main?all=true"><span class="icon-home"></span>&nbsp;主页</a></li>
                        <li class="active"><a href="${pageContext.request.contextPath}/diary?action=preSave"><span class="icon-pencil"></span>&nbsp;写日记</a></li>
                        <li class="active"><a href="${pageContext.request.contextPath}/diaryType?action=list"><span class="icon-book"></span>&nbsp;日记分类管理</a></li>
                        <li class="active"><a href="${pageContext.request.contextPath}/user?action=preSave"><span class="icon-user"></span>&nbsp;个人中心</a></li>
                    </ul>
                </div>

                <form name="myForm" class="navbar-form pull-right" method="post" action="${pageContext.request.contextPath}/main" onsubmit="return checkForm()">
                    <input class="span2" id="s_title" name="s_title"  type="text" style="margin-top:5px;height:30px;" placeholder="年轻人不讲武德...">
                    <button type="submit" class="btn" onkeydown="if(event.keyCode==13) myForm.submit()"><span class="icon-search"></span>&nbsp;搜索日志</button>
                </form>
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="container">
        <div class="row-fluid">
            <div class="span9">
                <jsp:include page="${mainPage}"/>
            </div>
            <div class="span3">
                <div class="data_list">
                    <div class="data_list_title">
                        <img src="${pageContext.request.contextPath}/static/images/user_icon.png"/>
                        个人中心
                    </div>
                    <div class="user_image">
                        <img src="${pageContext.request.contextPath}/${currentUser.imageName}"/>
                    </div>
                    <div class="nickName">
                        ${currentUser.nickName}
                    </div>
                    <div class="userSign">
                        (${currentUser.mood})
                    </div>
                </div>
                <div class="data_list">
                    <div class="data_list_title">
                        <img src="${pageContext.request.contextPath}/static/images/byType_icon.png"/>
                        按日志类别
                    </div>
                    <div class="datas">
                        <ul>
                            <c:forEach var="diaryType" items="${diaryTypeCountList}">
                                <li>
                                    <span><a href="${pageContext.request.contextPath}/main?s_typeId=${diaryType.diaryTypeId}">${diaryType.typeName}(${diaryType.diaryCount})</a></span>
                                </li>
                            </c:forEach>
                        </ul>
                    </div>

                </div>
                <div class="data_list">
                    <div class="data_list_title">
                        <img src="${pageContext.request.contextPath}/static/images/byDate_icon.png"/>
                        按日志日期
                    </div>
                    <div class="datas">
                        <ul>
                            <c:forEach var="diary" items="${diaryCountList}">
                                <li>
                                    <span><a href="${pageContext.request.contextPath}/main?s_releaseDateStr=${diary.releaseDateStr}">${diary.releaseDateStr}(${diary.diaryCount})</a></span>
                                </li>
                            </c:forEach>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>